package com.varian.security.properties;

import cn.hutool.crypto.asymmetric.RSA;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author ben
 * @since 2024/7/2
 */
@Data
@ConfigurationProperties(prefix = "varian.security")
public class VarianSecurityProperties {

    @NotBlank(message = "public key不能为空")
    private String publicKey;

    @NotBlank(message = "private key不能为空")
    private String privateKey;

    public RSA getRsa() {
        this.publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm7LGlmjKGIRPQR749E2bwQy5vvZPpbw19t3GySGs4RXKL4mAWhLJCt0CBdnc7TbfghF3XSg1tihXApLbwsawYcmLgjqZAgFAKi32Rv9r24AB0czwU9oQx6dOGpMdAwMIz1XsywjikKwG8mJK7X2snX2q6VhzhcA1twbyu3oFuJVCuHEjfLvVRleMYpuI2ZMAFVEWfmrFqfi9RRG26bl96Fx82j4hI+ouWIEkQzBomzsAj7u20zb4folE4qMZmaNXv+P1A3DV3jaIPxzkiFSda5LRj0SK60/QfYHYKCScbCDOCgxYE6EU1fNRQ6sD6XTh/j3vjKtHUijXl2R73UMh4wIDAQAB";
        this.privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCbssaWaMoYhE9BHvj0TZvBDLm+9k+lvDX23cbJIazhFcoviYBaEskK3QIF2dztNt+CEXddKDW2KFcCktvCxrBhyYuCOpkCAUAqLfZG/2vbgAHRzPBT2hDHp04akx0DAwjPVezLCOKQrAbyYkrtfaydfarpWHOFwDW3BvK7egW4lUK4cSN8u9VGV4xim4jZkwAVURZ+asWp+L1FEbbpuX3oXHzaPiEj6i5YgSRDMGibOwCPu7bTNvh+iUTioxmZo1e/4/UDcNXeNog/HOSIVJ1rktGPRIrrT9B9gdgoJJxsIM4KDFgToRTV81FDqwPpdOH+Pe+Mq0dSKNeXZHvdQyHjAgMBAAECggEAOXKULWkKsFMZPwjjiJieEHPWkSwmpRs1uhmI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xBYL1Vh500QEtuDlmWZQF9SdqGmbplbTBIDl4gaAicrFfYFuPv+8aKuIK/ocHK8LNui42K/0M6l29S4NPE0uvEFQKpAts=";
        return new RSA(privateKey, publicKey);
    }
}
